package com.wise.site.protocol.action;

import com.wise.site.protocol.base.SoapAction;
import com.wise.site.protocol.result.BussinesItemsResult;

/**
 * 供求action
 * @author huangyue
 *
 * 2012-9-20
 */
public class BusinessAction extends SoapAction<BussinesItemsResult>{
	private int page = 1;
	private int type;

	public BusinessAction(
			com.wise.site.protocol.base.SoapAction.ACTION_TYPE type,
			String method) {
		super(type, method);
	}
	
	/**
	 *  #0供应 1 求购
	 *
	 * huangyue  2012-9-27
	 */
	public void setType(int type){
		this.type = type;
		addJsonParam("type", type);
	}
	
	/**
	 * 关键字
	 *
	 * huangyue  2012-9-27
	 */
	public void setKeyword(String keyword){
		addJsonParam("keyword", keyword);
	}
	
	public void moveToNextPage(){
		addJsonParam("page", page);
	}
	
	public void moveToFristPage(){
		page = 1;
		addJsonParam("page", page);
	}
	
	public void setShopId(int shopId){
		addJsonParam("ShopId", shopId);
	}
	
	/**
	 * MemberID #用户登录ID 如果为0取得所以供求，如果大于0取得相应人员的供求
	 *
	 * huangyue  2012-9-27
	 */
	public void setMemberID(int memberID){
		addJsonParam("MemberID", memberID);
	}
	
	/**
	 *#供求类别 

	 * huangyue  2012-9-27
	 */
	public void setStype(int stype){
		addJsonParam("stype", stype);
	}

	@Override
	protected BussinesItemsResult parseJson(String response) throws Exception {
		BussinesItemsResult br = new BussinesItemsResult();
		br.parseData(response);
		page++;
		return br;
	}

}
